{include file="header.html"}
<div id="main" class="w-full">
<div id="page-cart" class="mb20">
   <div class="w step step1 mt10 clearfix">
      <span class="fs14 strong fff">{$lang.ckgwc}</span>
      <span class="fs14 strong">{$lang.qrddxx}</span>
      <span class="fs14 strong">{$lang.fk}</span>
      <span class="fs14 strong">{$lang.qrsh}</span>
      <span class="fs14 strong">{$lang.pj}</span>
   </div>
   
   <div class="cartbox w mt20 mb10">
      <div class="amount">
         
      </div>
      <div class="w title clearfix">
         <span class="col-desc">{$lang.store_goods}</span>
         <span>{$lang.price}</span>
          <!--lichen 2019/4/24 start-->
          <span>{$lang.tax_price}</span>
          <!--lichen 2019/4/24 end-->
         <span>{$lang.quantity}</span>
         <span>{$lang.subtotal}</span>
         <span>{$lang.handle}</span>
      </div>
      <div class="content">
         <!--{foreach from=$carts item=cart key=store_id}-->
         <div class="store-each" data-storeid="{$store_id}">
            <div class="store-name mt10"><input type="checkbox" checked='checked' class="checkall"/>{$lang.store}{$lang.colon}<a href="{url app=store&id=$store_id}">{$cart.store_name|escape}</a></div>
            <!--{foreach from=$cart.goods item=goods name=fe_goods}-->
            <dl class="goods-each clearfix" id="cart_item_{$goods.rec_id}">
			<dd><input type="checkbox" checked='checked' value="{$goods.rec_id}" class="checkitem" data-subtotal="{$goods.subtotal}"/></dd>
               <dd class="pic"><a class="block" href="{url app=goods&id=$goods.goods_id}" target="_blank"><img src="{$goods.goods_image}" alt="{$goods.goods_name|escape}" width="80" height="80" /></a></dd>
               <dd class="desc">
                  <p><a href="{url app=goods&id=$goods.goods_id}" target="_blank">{$goods.goods_name|escape}</a></p>
                  <span class="f66">{$goods.specification}</span>
               </dd>
               
               <dd class="price">
                   <!--{if $goods.goods_type neq GOODS_TYPE_NORMAL}--><p class="old_price">{$goods.goods_old_price|price}</p><!--{/if}-->
                   <p class="now_price">{$goods.price|price}</p>
                   <!--{if $goods.goods_type neq GOODS_TYPE_NORMAL}--><p class="goods_type">({$goods.goods_type|modifier:goods_type_status})</p><!--{/if}-->
               </dd>
                <!--lichen 2019/4/24 start-->
                <dd class="price">
                    <p class="now_price">{$goods.tax_price|price}</p>
                </dd>
                <!--lichen 2019/4/24 end-->
               <dd class="quantity">
                  <a class="decrease" href="javascript:void(0)" alt="{$lang.decrease}" onclick="decrease_quantity({$goods.rec_id});">-</a>
                  <input class="" id="input_item_{$goods.rec_id}" value="{$goods.quantity}" orig="{$goods.quantity}" changed="{$goods.quantity}" onkeyup="change_quantity({$store_id}, {$goods.rec_id}, {$goods.spec_id}, this);" type="text" />
                  <a class="increase" href="javascript:void(0)" alt="{$lang.increase}" onclick="add_quantity({$goods.rec_id});">+</a>
               </dd>
               <dd class="subtotal fs14 strong" id="item{$goods.rec_id}_subtotal">{$goods.subtotal|price}</dd>
                <!--lichen 2019/4/24 start-->
                <dd class="handle" style="width:120px;">
                <!--<dd class="handle" style="width:160px;">-->
                <!--lichen 2019/4/24 end-->
                   <a class="move" href="javascript:;" onclick="move_favorite({$store_id}, {$goods.rec_id}, {$goods.goods_id});">{$lang.move_favorite}</a>
                   <br />
                   <a class="del" href="javascript:;" onclick="drop_cart_item({$store_id}, {$goods.rec_id});">{$lang.drop}</a>
               </dd>
            </dl>
            <!-- {/foreach} -->
            <div class="cart-amount mt10 w auto mb10 clearfix">
               <div class="btn-amount">
                  <p>
                     <span>{$lang.goods_amount}{$lang.colon}</span>
                     <strong class="price fs14 strong mr20"  id="cart{$store_id}_amount">{$cart.amount|price}</strong>
                  </p>
               </div>
            </div>
         </div>
         <!--{/foreach}-->
      </div>
   </div>
    <div class="cartbox">
        <div class="total_amount">
            <div class="toolbar w">
                <a href="javascript:go_to_order()" class="submit_btn">{$lang.next_order_form}</a>
            </div>
        </div>
    </div>
   <div class="w interest mt20">
      <div class="title border fs14 padding5 f66 strong"><span class="arr"></span>{$lang.interest_note}</div>
      <div class="content border border-t-0 clearfix">
         <!--{foreach from=$interest item=goods}-->
         <dl class="float-left">
           <dt><a href="{url app=goods&id=$goods.goods_id}" target="_blank"><img width="160" height="160" src="{$goods.default_image}" /></a></dt>
           <dd class="desc"><a href="{url app=goods&id=$goods.goods_id}" target="_blank">{$goods.goods_name|escape|truncate:50}</a></dd>
           <dd class="price clearfix"><em>{$goods.price}</em><span>{$lang.zjcj}{$goods.sales}{$lang.bi}</span></dd>
           <dd class="service"></dd>
         </dl> 
         <!--{/foreach}-->
      </div>
   </div>
</div>
</div>
<script>
    $(function(){
            /* 全选 */
    $('.checkall').click(function(){
        var _self = this;
        $(this).parents('.store-each').find('.checkitem').each(function(){
            if (!this.disabled)
            {
                $(this).attr('checked', _self.checked);
            }
        });
        $(this).attr('checked', this.checked);
    });
    $(".content input[type=checkbox]").change(function(){
        $(".store-each").each(function(){
            var subtotal=0;
            $(this).find('.checkitem:checked').each(function(){
                var price=parseFloat($(this).attr('data-subtotal'));
                subtotal=ForDight(subtotal+price,2);
            });
            var store_id=$(this).attr('data-storeid');
            $(this).find('#cart'+store_id+'_amount').text(price_format(subtotal));
        });
        
    });
    })
    function go_to_order(){
                    if ($('.checkitem:checked').length == 0) {
                return false;
            }

            var items = '';
            $('.checkitem:checked').each(function() {
                items += this.value + ',';
            });
            items = items.substr(0, (items.length - 1));

            var uri =  'index.php?app=order&goods=cart&batch=1&rec_ids=' + items;
            window.location.href=uri;return;
    }
    //四舍五入函数
function   ForDight(Dight,How)  
{  
            Dight   =   Math.round   (Dight*Math.pow(10,How))/Math.pow(10,How);  
            return   Dight;  
}  
</script>
{include file=server.html}
{include file="footer.html"}